//
//  WJBHomePageViewController.m
//  VariousPlay
//
//  Created by dllo on 15/12/21.
//  Copyright © 2015年 wangjingbo. All rights reserved.
//

#import "WJBHomePageViewController.h"
#import "WJBHomePageView.h"
#import "WJBChooseTypeViewController.h"

#import "WJBCityListViewController.h"
#import "WJBTodayHomePageViewController.h"
#import "WJBFoundViewController.h"
#import "WJBRecordViewController.h"

@interface WJBHomePageViewController ()<UIScrollViewDelegate>
@property (nonatomic, strong)WJBHomePageView *homeView;
@property (nonatomic, strong)UIScrollView *scrollV;
@property (nonatomic, strong)NSMutableArray *homeArr;

@end

@implementation WJBHomePageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.homeArr = [NSMutableArray array];
    self.navigationItem.leftBarButtonItem = nil;
    [self.navigationController.navigationBar addSubview:self.homeView];
    
    self.scrollV = [[UIScrollView alloc]initWithFrame:self.view.frame];
    self.scrollV.contentSize = CGSizeMake(SCREEN.size.width * 3, 0);
    self.scrollV.pagingEnabled = YES;
    self.scrollV.delegate = self;
    self.scrollV.contentOffset = CGPointMake(SCREEN.size.width, 0);
    [self.view addSubview:self.scrollV];
    
    WJBTodayHomePageViewController *todayVC = [[WJBTodayHomePageViewController alloc]init];
    [self addChildViewController:todayVC];
    [self.scrollV addSubview:todayVC.view];
    
    WJBFoundViewController *foundVC = [[WJBFoundViewController alloc]init];
    [self addChildViewController:foundVC];
    CGRect rectFound = foundVC.view.frame;
    rectFound.origin.x = SCREEN.size.width;
    [self.scrollV addSubview:foundVC.view];
    
    WJBRecordViewController *recordVC = [[WJBRecordViewController alloc]init];
    [self addChildViewController:recordVC];
    CGRect rectTecord = recordVC.view.frame;
    rectTecord.origin.x = SCREEN.size.width;
    recordVC.view.frame = rectTecord;
    [self.scrollV addSubview:recordVC.view];
    
    //是否是第一次启动
    if (![[NSUserDefaults standardUserDefaults] objectForKey:@"isFirst"]) {
        [[NSUserDefaults standardUserDefaults]setValue:@"1" forKey:@"isFirst"];
        WJBChooseTypeViewController *chooseVC = [[WJBChooseTypeViewController alloc]init];
        [self presentViewController:chooseVC animated:YES completion:^{
            
            
        }];
    }
    //接收城市改变通知
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(homeRefurbish:) name:@"Refurbish" object:nil];
    
    //接受定为通知
    
    
}
#pragma maek - 城市改变通知
//- (void)homeRefurbish:(NSNotification *)sender{
//    [self.homeView ];
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
